<template>
  <div class="notice" @click="hiddenNotice" v-show="showNotice">

  </div>
  <Transition enter-active-class="animate__fadeInRightBig" leave-active-class="animate__fadeOutRightBig">

    <div class="notice__body  animate__animated animate__fast" v-show="showNotice">
      <div class="notice__body__header">
        <span>通知</span>
        <el-button @click="hiddenNotice"
          style="color: #000; background-color: rgba(30, 144, 255, .04);width: 40px;height: 40px;padding: 0;">
          <icon-ic-sharp-close />
        </el-button>
      </div>
      <div class="notice__body__main">
        <NoticeItem v-for="_ in 20" />
      </div>
    </div>
  </Transition>
</template>

<script setup lang="ts">
import { inject, ref, Ref } from 'vue';
import NoticeItem from './notice-item.vue'

const showNotice = inject<Ref<boolean>>("showNotice")

function hiddenNotice() {
  console.log(123);

  showNotice!.value = false;
}

</script>

<style scoped lang="scss">
.notice {
  position: fixed;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;

  &.show {
    background-color: rgba($color: #000000, $alpha: .2);

  }




}

.notice__body {
  position: absolute;
  z-index: 999;
  top: 20px;
  bottom: 20px;
  right: 49px;
  width: 350px;
  background-color: white;
  border-radius: 20px;
  box-shadow: 2px 2px 5px rgba($color: #000000, $alpha: .1), -2px -2px 5px rgba($color: #000000, $alpha: .1);


  &__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #ccc;
    padding: 20px;

    >span {
      font-size: 20px;
    }
  }
}

.notice__body__main {
  height: 1084px;
  overflow: scroll;

  &::-webkit-scrollbar {
    display: none;
  }
}
</style>